home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d968.lha / JustLook / Examples / ExampleSources / GoOverIcon.jl.c < prev    next >
C/C++ Source or Header  |  1993-12-04  |  1KB  |  52 lines

  1. /* GoOverIcon.jl  By Kamran Karimi
  2.  
  3.    Should be linked with JustLook (© Kamran Karimi) routines.
  4. */
  5.  
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include <intuition/intuition.h>
  9. #include <clib/exec_protos.h>
  10. #include <clib/dos_protos.h>
  11. #include <clib/intuition_protos.h>
  12.  
  13. #include "JustLook.h"
  14.  
  15. struct IntuitionBase *IntuitionBase = NULL;
  16. struct Library *IconBase = NULL;
  17.  
  18. #define Write_err printf("err = %0lx\n",err)
  19.  
  20. main()
  21. {
  22.  struct Window *win;
  23.  ErrorCode err;
  24.  struct ScrMap SM;
  25.  
  26.  IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
  27.  if(IntuitionBase == 0) exit(100);
  28.  IconBase = OpenLibrary("icon.library",0);
  29.  if(IconBase == 0) exit(99);
  30.  
  31.  win = FindWindow("Workbench",NULL);
  32.  if(win > WIN_REPEATED) 
  33.  {
  34.   WindowToFront(win);
  35.   InitSM(&SM,win->WScreen);
  36.   err = GoOverIcon(&SM,win,"DH0:Disk");
  37.   Write_err;
  38.   Delay(50);
  39.   err = Click(&SM,LBUTTON,0,DOWN_UP);
  40.   Write_err;
  41.   err = Click(&SM,LBUTTON,0,DOWN_UP);
  42.   Write_err;
  43.  }
  44.  else 
  45.  {
  46.   if (win == WIN_REPEATED) printf("Two Workbench windows are open!!!\n");
  47.   else printf("Workbench window not found!\n");
  48.  }
  49.  CloseLibrary((struct Library *)IntuitionBase);
  50.  exit(0);
  51. }
  52.